import axios from 'axios';

let base = '';
let ims = "http://192.168.0.64:9010/web/anonymous"
let demo = "http://192.168.0.64:9010/demo"
/*export const requestLogin = params => { return axios.post(`http://192.168.0.56:9010/admin/login`, params).then(res => res.data); };*/

export const getUserList = params => { return axios.get(`${base}/user/list`, { params: params }); };

/* export const getUserListPage = params => { return axios.get(`${base}/user/listpage`, { params: params }); }; */

/*export const removeUser = params => { return axios.post(`${admin}/news/delete`, { params: params }); };*/

export const batchRemoveUser = params => { return axios.get(`${base}/user/batchremove`, { params: params }); };

//新闻类型下拉数据
export const getNewsType = params => { return axios.get(`${ims}/news/findClass`, { params: params }); };
//修改新闻
export const editNews = params => { return axios.put(`${ims}/news/update`, params).then(res => res.data); };
//新增新闻
export const addNews = params => { return axios.post(`${ims}/news/add`, params).then(res => res.data); };
//新闻列表
export const getNewsListPage = params => { return axios.get(`${ims}/news/findNews`, { params: params }); };
//新闻上传图片
export const getNewsUpload = params => { return axios.get(`${ims}/news/file`, { params: params }); };
//删除新闻
export const removeNews = params => { return axios({ method: 'delete', url: `${ims}/news/delete`,data: params});};

//------------------------demo----------------------------
//列表
export const getDemoListPage = params => { return axios.get(`${demo}/demo/findDemo`, { params: params }); };
//新增
export const addDemo = params => { return axios.post(`${demo}/demo/addDemo`, params).then(res => res.data); };
//修改
export const editDemo = params => { return axios.put(`${demo}/demo/updateDemo`, params).then(res => res.data); };
//删除
export const deleteDemo = params => { return axios({ method: 'delete', url: `${demo}/demo/deleteDemo`,data: params});};
//下拉
export const getDemoSelect = params => { return axios.get(`${demo}/eSelect/findESelect`, { params: params }); };
//级联
export const getDemoTree = params => { return axios.get(`${demo}/eSelect/findTree`, { params: params }); };

//图表数据
export const getChars = params => { return axios.get(`${demo}/count/findCount`, { params: params }); };

